Method for compression and decompression of image data

ABSTRACT

The invention relates to a method for compression and decompression of pixel-based image data. Each pixel first has the pixel value determined. A pixel difference value is then determined for each pixel, from a given number of neighbouring pixels, which results from the difference in the pixel value for the pixel in question to each of the neighbouring pixels thereof. The pixel difference values are then sorted in descending order. Each pixel used for the calculation of a pixel difference value is assigned to a pixel group. The pixel groups obtained thus are stored according to the descending sorting of the pixel difference values. For regeneration of the image the pixel groups with the highest pixel difference values are first loaded. A triangle is formed from the three closest pixel groups. The surfaces of each triangle are filled in a colouring process, calculated from the colour values of the pixel groups forming each of the three corners of the triangle. The more pixel groups are loaded the smaller the triangles become and the more precise the reconstruction of the image.

BACKGROUND OF THE INVENTION

[0001] The invention relates to a method for the compression and decompression of image data.

[0002] Today there are a plurality of technologies and compression methods for storing image data. The technologies used derive essentially from pixel-based and vector-based methods.

[0003] In the case of the pixel-based technologies a raster is laid over the image. Each raster point corresponds to one pixel. A pixel value is encoded with one bit (for example, WBMP→black and white) or several bits (for example, BMP→true color). In order to reduce the size of the image files various compression methods can be applied. An effective method consists of reducing the bits per pixel. Furthermore, methods can be applied in which pixels are combined into groups. These are, as a rule, square areas which are then transformed with the aid of the DCT (discrete cosine transformation) into the frequency domain. The high frequency content arising in the transformation can be ignored without noticeable loss of quality. This method is, for example, applied in JPEG images. In the case of very high JPEG compressions it can lead to distorting, disordered patches of rectangles in the image, so-called artifacts.

[0004] In the case of vector-based methods the image is described unambiguously with the aid of geometric forms (for example, rectangles, or circles). A known method is the so-called SVG (scaleable vector graphics). This method can be used with outstanding results in technical drawings since images prepared in this manner can be scaled very well. The corresponding files are clearly smaller than in traditional binary bitmap formats. However, these methods are less suited to storing photographs.

[0005] Along with the traditional photographic apparatuses which expose a film, more and more there are photographic apparatuses which store the photograph digitally on a storage medium instead of on film. Since these storage media only have a limited capacity, only a small number of high-resolution photographs, or many images with low resolution, can be stored. A flexible scaling is not possible at the present time.

SUMMARY OF THE INVENTION

[0006] The objective of the invention is to provide a method for the compression and decompression of image data, said method permitting a simple and flexible adaptation to storage size, different image resolutions, and display sizes.

[0007] This objective is realized by the features of claim 1.

[0008] Advantageous developments and extensions of the invention are specified in the subordinate claims.

[0009] The invention is based on a combination of the pixel-based and vector-based technology. As the first step the image is covered with a raster. For each pixel of the raster the pixel value, i.e., the color value or luminance value, is first determined. Subsequently an additional value, in the following called the pixel difference value, is calculated for each pixel from a previously determined number of neighboring pixels. The pixel difference value follows from the difference of the pixel value of a pixel under consideration and that of each of its neighboring pixels under consideration. The greater the difference of the pixel value relative to that of its neighboring pixels is, the greater this pixel difference value is. Subsequently the pixel difference values of the individual pixels of the image are sorted in decreasing order. Each of the pixels used for the calculation of a pixel difference value is incorporated into a pixel group. The pixel groups thus obtained are stored in the decreasing order of the pixel difference values, that is, according to the priority determined by the pixel difference value. A priority list results, where those pixel groups appear first on the list whose pixel difference value, and thus priority, is greatest.

[0010] The pixel values of the pixel groups can be further compressed by run length encoding or other known compression methods, for example, zip methods.

[0011] For the reproduction of the image, the pixel groups with the highest pixel difference value (priorities) are first loaded. From the three closest pixel groups a triangle is formed. Triangles are scaleable in their size and can thus be adapted to different resolutions. If certain areas of the images are to be reproduced particularly precisely, the pixel groups for these areas can be provided with a higher priority. The surface of the respective triangle is filled by a color gradient which is calculated from the color values of each of three pixel groups forming the corners of the triangle. In black-and-white images the respective luminance value of the pixels or pixel groups is considered instead of the color values and a corresponding luminance gradient is calculated.

[0012] The more pixels are represented, the smaller the triangles are, and thus the more precisely the image can be reconstructed.

[0013] The advantages of the method according to the invention lie in high scaleability due to simple adaptation to different display sizes and the possibility of increased resolution of interesting areas of an image by prioritizing certain areas of an image.

[0014] The method makes it possible for the manufacturer or image-processing professionals to use manufacturer-specific optimization routines by the different prioritizations. However, since the source pixel values are always transmitted, the image can also be generated without the use of the manufacturer-specific optimization routines.

[0015] Furthermore, an increase of resolution of details is possible by reloading the interesting areas of the image instead of reloading a completely new image with another resolution.

[0016] The method is very fault-tolerant since the image can also be generated once again in case of transmission errors of individual pixel groups.

[0017] An embodiment example of the invention is explained in more detail with the aid of the figures in the drawings. Additional features, advantages, and possibilities of application of the invention follow from the drawings and their description. Shown are:

BRIEF DESCRIPTION OF THE DRAWINGS

[0018]FIG. 1: a representation of an image array of 20×21 pixels

[0019]FIG. 2: a representation of various forms of pixel groups,

[0020]FIG. 3: a newly generated image array with inserted pixel groups in the corner of the image,

[0021]FIG. 4: filling of the surfaces between the pixel groups already filled,

[0022]FIG. 5: inserting additional pixel groups and filling of the surfaces lying therebetween.

DETAILED DESCRIPTION OF THE DRAWINGS

[0023] In the following a compression and decompression of a 2-dimensional image file (image array) is described with the aid of an example.

[0024] The following assumptions are made:

[0025] The image source is present as a bit map, that is, as an image array.

[0026] Each pixel of the image array is represented by a 32-bit value (pixel value). The 32 bits are, for example, subdivided into 4 values (transparent, red, green, blue), each with 8 bits.

[0027] The image array represented as an example is an image of the image width of 20 pixels and an image height of 21 pixels. The position of the pixels is determined by an integer. The image array is enumerated from 0 to 419 in the manner shown in FIG. 1. The number within each box corresponds to the position of the corresponding pixel.

[0028] The compression of the image is done in the following manner:

Reading in the Image Array

[0029] An image is read into the 20×21 pixel image array shown in FIG. 1. Each pixel is defined by its position (0 to 419) and its pixel value (color or luminance value).

Determining Pixel Groups

[0030] Next it is determined which neighboring pixels form a pixel group. In so doing, p0 denotes that pixel which specifies the position of the pixel group. The position of the remaining pixels, e.g., p1-p4, of a pixel group relative to the reference pixel p0 follows from the type (form) of pixel group used. In FIG. 2, by way of example, several possible forms of pixel groups are represented. Pixel groups which are symmetric to the reference pixel p0 as well as pixel groups which are asymmetric to the reference pixel p0 can be formed. Which type of pixel group is used is, among other things, dependent on the type of image material and the desired compression rate. As a rule, the more pixels a pixel group includes the larger the compression factor to be achieved is. The same form of pixel group must be used for encoding and decoding, e.g., compressing and decompressing, the image.

[0031] In the further description of the method, processing will be with the form of the pixel group in FIG. 2 with a boldface border (lower left).

Determining Priority Values

[0032] For each pixel p0 of a pixel group the priority in relation to its pixel group is calculated. In so doing each pixel 0-419 of the image becomes the reference pixel once.

[0033] The pixels at the edge of the image can be subjected to a special treatment, for example, by selection of a certain pixel group form in the area of the edge or reduction of the surface under consideration (cutting off of the edge areas).

[0034] For the calculation of the priority there can be various methods of computation. By way of example, a linear method is used here. For this, the individual pixel values P0, P1, P2, P3, and P4 of a pixel group are divided into their color content red, green, and blue. Each of these color values is represented by 8 bits. For each color of each pixel P1-P4 a color difference value is determined relative to P0, for example, P0_red-P1_red, P0_red-P2_red, . . . , P0_blue-P4_blue. The absolute color difference values are added and divided by the number of the colors and the number of the pixels under consideration. The result is a priority value for the pixel group under consideration. The more different the color values of the individual pixels of the pixel group are, the greater the priority value.

[0035] Additional methods for the determination of the priority value are the utilization of gray tones or the maximal value of a color difference of a color. Since later the priority value itself is not transmitted or stored, the method for the determination of the priority value has no direct influence on the decoding.

[0036] Through this prioritization one achieves the result that image areas which have a great alternation of color or contrast, such as, for example, edges, receive a high priority and image contents remaining relatively constant, such as, for example, blue sky, receive a lower priority.

Sorting Priority Values

[0037] In this step the priority values are sorted in decreasing order. Depending on the implementation, a sorting can be carried out after determining each new priority value, or at a still later time.

[0038] Depending on the available resources, dependence on the position of the prioritized pixel groups can be drawn upon along with the pure prioritization by the color values of neighboring pixels.

[0039] An instance of application should illustrate this. If, at sea, one observes a horizon, it appears as a horizontal line. It is to be expected that the priority values of each pixel group along this horizon are approximately equal. In this case the points of the line of the horizon lying furthest from one another have the greatest power to provide information. Merely by transmitting the leftmost and rightmost pixel groups of the horizon it is possible to reconstruct it once more.

[0040] An additional possibility of prioritization lies in the higher valuation of certain areas of the image. Such an area of an image can, for example, be faces in photographs. Although faces in vacation photographs often only make up, as a percentage, a small area of the entire image, they are usually the center of attention. Such a human perceptual process can be taken into account by corresponding prioritization of the pixel groups of these areas of the image (face areas). Likewise the pixel groups in the center of the image can be subjected to a correspondingly higher prioritization.

[0041] An additional possibility of the optimization consists of the fact that neighboring pixel groups are mutually superimposed. Through clever selection of the pixel groups it is possible to avoid superimposed pixel values of neighboring groups being redundantly transmitted.

[0042] If the image to be compressed is taken directly with a CCD camera or a scanner, there is in principle the possibility of obtaining an array sorted according to priorities directly from the image-processing microchip present in the camera/scanner. Thus a significant portion of the computational effort in the compression is spared.

Storing Pixel Groups

[0043] First several parameters of the image are stored. Listed by way of example are the:

[0044] image width (in pixels)

[0045] image height (in pixels)

[0046] used form of the pixel group (not necessary if only one form is standardized)

[0047] the 4 pixel groups of the image corners.

[0048] Subsequently the individual pixel groups are stored according to their priority, that is, pixel groups with high priority are stored first (and later also read out first).

[0049] For this, the position value of the reference pixel p0 of the pixel group is first stored. Subsequently the pixel values P0, P1, P2, P3, P4 are stored.

[0050] Example:

[0051] Position value P0, pixel values P0, P1, P2, P3, P4; next position value P0 (with the same or lower priority), pixel values P1, P2, P3, P4, . . . , next position value P0 (with the lowest priority), pixel values P0, P1, P2, P3, P4.

[0052] The storing can be optimized by various methods which are addressed here only by way of example.

[0053] A run length encoding of the pixel groups can be performed. For example, if in an area of the image no red content appears, it can be transmitted with, for example, only 2 bits instead of 8 (red), or the number of leading zeros can be exploited.

[0054] Furthermore, customary compression methods, e.g., zip format, can be used.

[0055] By determining a limiting value for the prioritization a certain quality can be ensured. For example, a limiting value for the pixel difference values can be determined below which the associated pixel group always receives the lowest priority value.

[0056] In a determination of a maximal file size it is ensured through the prioritization that the essential image information is stored first.

Decompressing the Image

[0057] Generating a New Image Array

[0058] For the generation of a new image the parameters of the image are first read in and evaluated.

[0059] The image width, image height, and form of the pixel group are an example. From these values an initially empty image array is then generated comparably to the representation in FIG. 1. If the image height and image width of the original image and the representation now desired do not agree (for example, limited PDA display or high-resolution screen), there must be corresponding scaling. For this, the recalculation factors are first determined (image width_original/image width_display and image height_original/image height_display). These factors can be used in order to convert by calculation the position value of the original image into the position value of the new display.

[0060] Inserting Corner Pixel Groups

[0061] As represented in FIG. 3 the prioritized pixel groups are now read in according to their order. First the 4 pixel groups are entered into the newly generated image array. The position (p0) of the respective pixel group is determined by the fields 21, 38, 381, or 398 shaded in black. This position value (p0) is present as an integer in the stored file. Subsequently the pixel values (p1-p4) belonging to the respective pixel group and shaded in dark gray are entered into the new image array. The pixel values lying therebetween and shaded light gray can then be calculated from the fields shaded dark gray and black. For the calculation the known pixel values are first divided into their components red, green, and blue. Subsequently the average value of each color is calculated, e.g., pixel(22)=(pixel(2)+pixel(21)+pixel(42))/3.

[0062] Filling Surfaces

[0063] Now the pixel groups present are connected to one another by lines. Triangles result whose corners are defined by the corresponding pixel groups. By way of example, this should be illustrated by the line between pixel position 2 and pixel position 17. The color gradient of the line is calculated with the aid of the color values of the pixels 2 and 17. First, the number of pixels between these two positions is determined, in this example 14. Subsequently the color difference is determined for each color (red, green, blue), for example, a color value of 2 at position 2 and a color value of 30 at position 17 yields a color difference of 28. A color value increase per pixel, from pixel 2 to pixel 17, is then calculated from the color difference/number (in the example, 28/14, which equals 2).

[0064] The surfaces still remaining are filled by drawing horizontal lines, for example, from position 63 to position 74, from position 82 to position 93, and so on. Also here a provisional color gradient between the points is calculated as specified above.

[0065] As FIG. 5 shows, each additional pixel group added yields additional triangles which can be filled accordingly. After the entire surface has first been filled by utilization of the 4 corner points (21, 38, 398, 381), the resolution can be refined with each additional pixel group. The addition of the pixel group 87 leads to 4 triangles with the reference points (21, 38, 87), (21, 87, 381), (381, 87, 398), (398, 78, 38). Now if an additional pixel group (247) is inserted within such a triangle, e.g., 87, 381, 398, 3 new triangles (247, 381, 398), (247, 87, 381), and (247, 87, 398) arise. Each new pixel group thus generates 3 new triangles which can be filled. The more pixel groups are inserted, i.e., the more triangles are formed, the nearer the calculated color gradient comes to the actual color gradient of the image. Since as of now it is always the case that only new triangles arise, methods optimized for the calculations are used. Furthermore, the 3 triangles newly arising each time can be calculated in parallel in order to increase the processing speed. An additional possibility for parallelizing arises thereby if new pixel groups are added in different regions of the image. 

We claim:
 1. Method for the compression of image data which consist of an array of individual image points (pixels) where each pixel (0-419) has a pixel value which describes the color or luminance information of the pixel, characterized by the steps: a) determining a priority value for each pixel of the array by calculating a pixel difference value with the aid of the respective pixel value of the pixel in relation to the pixel values of a previously determined group of neighboring pixels, b) combining the pixels used for the calculation of priority value into a pixel group (P0-P4), c) sorting the pixel groups of the image array with the aid of their priority value, and d) storing and/or transmitting the pixel groups according to their priority.
 2. Method according to claim 1, characterized by the fact that the pixel difference value follows from the difference of the pixel value of a pixel under consideration and each of its neighboring pixels under consideration.
 3. Method according to one of foregoing claims, characterized by the fact that first the parameters of the image, such as image width in pixels, image height in pixels, form of the pixel group used, and the corner pixel groups of the four image corners, are stored and/or transmitted.
 4. Method according to one of the foregoing claims, characterized by the fact that for each pixel group the position of a reference pixel (P0) whose pixel value is stored or transmitted, along with the pixel values of the remaining pixels (P1-P4).
 5. Method according to one of the foregoing claims, characterized by the fact that an increased priority is assigned to pixel groups of certain areas of an image.
 6. Method according to one of the foregoing claims, characterized by the fact that the pixel values of the pixel groups are further compressed by run length encoding or other compression methods.
 7. Method according to one of the foregoing claims, characterized by the fact that the determination and output of the pixel groups sorted according to priorities is already done by an image-exposing system used, such as, for example, a scanner or CCD camera.
 8. Method for the decompression of picture data that have been compressed with the method according to claims 1 to 7, characterized by the steps: a) generating an empty image array from the read-in parameters for the compressed image, b) reading in the corner pixel groups and inserting them at the four corners of the image array, c) forming triangles by connecting each of three immediately neighboring pixel groups by at least one line, d) filling the pixels forming the surface of the triangle by a color or luminance gradient calculated from the pixel group forming the triangle, e) reading in and inserting the next pixel group into the image array, f) repeating steps c) to f).
 9. Method according to claim 7, characterized by the fact that the steps c) to f) are repeated until all, or a desired number of, image data have been read in and processed.
 10. Method according to claim 7 or 8, characterized by the fact that the triangles are scaleable in their size and adaptable to different image resolutions. 